package com.sen.controller;


import com.sen.dto.AccountDTO;
import com.sen.entity.Account;
import com.sen.result.Result;
import com.sen.service.AccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author sen
 * @since 2021-03-13
 */
@Api(tags = "用户控制器")
@RestController
@RequestMapping("/account")
public class AccountController {

    @Autowired
    private AccountService accountService;

    @ApiOperation(value = "新增一个角色")
    @PostMapping
    public Result addAccount(@RequestBody AccountDTO accountDTO){
        return accountService.saveAccount(accountDTO);
    }

    @ApiOperation(value = "获取用户列表")
    @GetMapping("/list/{cur}/{size}")
    public Result listAccount(@PathVariable Integer cur, @PathVariable Integer size){
        Result result = accountService.getAccountList(cur, size);
        return result;
    }
}
